﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RearLivestock.Common.Domains.zjy;
using RearLivestock.Common.Dtos;
using RearLivestock.RBAC.Api.Application.zjyApplication.Commands.Menu;

namespace RearLivestock.RBAC.Api.Controllers.zjy
{
    /// <summary>
    /// 菜单控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class MenusController : ControllerBase
    {
        private readonly IMediator _mediator;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public MenusController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 获取菜单信息
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost("GetMenus")]
        public async Task<Result<List<Permissions>>> GetMenus(SearchMenuCommand cmd)
        {
            var result = await _mediator.Send(cmd);
            return result;
        }
    }
}
